#ifndef _SHADOW_SERVER_H_
#define _SHADOW_SERVER_H_

#include <log4cxx/logger.h>
#include <log4cxx/xml/domconfigurator.h>

#include "SSCF.h"
#include "SMsg.h"

#define SSERVER_PROTO_SMSG_SEP "\r\n"

class SServer {

		public:
				SServer();
				virtual ~SServer();
				virtual int init(int listen_port, int max_thread_num, int socket_idel_timeout, int smsg_recv_timeout, \
								int smsg_send_timeout, int smsg_max_packet_size);
				virtual int start_svc();
				virtual int handle_smsg(SSocket * s, SMsg & in_msg, SMsg & out_msg);
		protected:
				static int sscf_read_event_handler(SSocket * s, void * arg);
		private:
				log4cxx::LoggerPtr _logger;
				SSCF _sscf;
				int _smsg_recv_timeout;
				int _smsg_send_timeout;
				int _smsg_max_packet_size;
};

#endif
